package com.flnet.spsys.controller;

import com.flnet.spsys.entity.TbTaskDetail;
import com.flnet.spsys.service.ITbTaskDetailService;
import com.flnet.spsys.utils.ResultJson;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/task")
public class TbTaskDetailController extends BaseController{
    @Autowired
    private ITbTaskDetailService iTbTaskDetailService;

    @ApiOperation(value = "任务详情",notes = "获取任务详情")
    @ApiResponses(
            @ApiResponse(code = 200,message = "获取成功",response = ResultJson.class)
    )
    @CrossOrigin
    @PostMapping("/info")
    public Object getTaskDetailInfo(){
        List<TbTaskDetail> tbTaskDetailList = iTbTaskDetailService.list();
        return ResultJson.success(tbTaskDetailList);
    }
    @CrossOrigin
    @PostMapping("/insert")
    public Object insertTaskDetail(TbTaskDetail tbTaskDetail){
        tbTaskDetail.setId(1);
        tbTaskDetail.setTaskSquare("任务广场");
        tbTaskDetail.setTitle("任务标题");
        tbTaskDetail.setCommentNumber(50);
        tbTaskDetail.setTaskType("加急");
        tbTaskDetail.setTaskRequirement("任务要求");
        tbTaskDetail.setWechatNumber("123456789");
        tbTaskDetail.setPhoneNumber("15845671234");
        tbTaskDetail.setCommentAbstract("留言摘要");
        boolean i = iTbTaskDetailService.save(tbTaskDetail);
        return i;
    }


}
